<extend name="Public/base" />
<block name="content">
    <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
        <ul class="layui-tab-title site-demo-title">
            <li class="layui-this"><a href="<{:U('Admin/index')}>">管理员列表</a></li>
            <li class=""><a href="<{:U('Admin/sys_config')}>">项目配置</a></li>
        </ul>

        <div class="layui-body layui-tab-content site-demo site-demo-body">
            <div class="layui-main">
                <div id="">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                        <legend>筛选</legend>
                    </fieldset>

                    <form class="layui-form" action="__ACTION__" METHOD="get">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">账号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="username" class="layui-input" placeholder="账号" value="<{:I('get.username')}>">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button class="layui-btn" lay-submit="" lay-filter="demo1">搜索</button>
                                <a class="layui-btn" href="<{:U('Admin/admin_add')}>">添加</a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

            <div class="layui-tab-item layui-show">
                <div class="layui-main">
                    <div id="LAY_preview">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                            <legend>管理员列表</legend>
                        </fieldset>
                        <table class="layui-table" >
                            <thead>
                            <tr>
                                <th>账号</th>
                                <th>绑定手机号</th>
                                <th>最后登录时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <volist name="list" id="vo">
                                <tr>
                                    <td><{$vo['username']}></td>
                                    <td><{$vo['mobile']}></td>
                                    <td><{$vo['last_login_time']|date="Y-m-d H:i:s",###}></td>
                                    <td>
                                        <a class="layui-btn layui-btn-mini" lay-event="edit" href="<{:U('Admin/admin_add', array('option'=>'update', 'id'=>$vo['id']))}>">编辑</a>
                                        <a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del" href="javascript:data_del('<{$vo.id}>')">删除</a>
                                    </td>
                                </tr>
                            </volist>
                        </table>
                        <{$_page}>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function data_del(value_id){
            layui.use('layer', function() {
                var layer = layui.layer;
                layer.confirm('确定删除？', {
                    shadeClose:true,
                    btn: ['确认', '取消']
                }, function(index){
                    $.post('<{:U("Admin/admin_del")}>', {id:value_id}, function(res){
                        //res就是返回的结果
                        if(res.status == '200'){
                            layer.msg(res.message, {icon: 1});
                            setTimeout(function(){
                                location.reload();
                            },1000);
                        } else {
                            layer.msg(res.message, {icon: 2});
                        }
                    });
                });
            })
        }
    </script>
</block>





